//幸运树问题
#include<bits/stdc++.h>
using namespace std;
/*
bool check_even(long long i)
{
int count = 0;
while(i>0)
{
i/=10;
count++;
}
if(count%2==0)
return true;
else
return false;	
}
*/
bool check_even(long long i)
{
	string s = to_string(i);
	long long ret = s.size();
	if(ret%2==0)
		return true;
	else
		return false;
		
}
/*
bool check_same(long long i)
{
long long count = 0;
long long tmp = i;
while(tmp>0)
{
tmp/=10;
count++;
}
long long size = count/2;
tmp = size;
long long back = 0;
while(tmp--)
{
int t = i%10;
i = i/10;
back += t;
}
long long front = 0;
tmp = size;
while(tmp--)
{
int t = i%10;
i = i/10;
front += t;
}
if(front == back)
return true;
else
return false;
}
*/
bool check_same(long long i)
{
	string s = to_string(i);
	long long len = s.size();
	int sumfront = 0;
	int sumback = 0;
	/*
	for(int j = 0;j<len/2;j++)
	{
		sumfront+=s[j]-'0';
	}
	for(int j = len-1;j>len/2-1;j--)
	{
		sumback+=s[j]-'0';
	}
	*/
	for(int j = 0;j<len;j++)
	{
		if(j<len/2)
			sumfront += s[j]-'0';
		else
			sumback += s[j]-'0';
	}
	if(sumfront == sumback)
		return true;
	return false;
}

int main()
{
	int count = 0;
	for(long long i=1;i<=100000000;i+=1)
	{
	   if(check_even(i) && check_same(i))
		   count++;
	}
	cout << count;
	return 0;
}
